<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			function cal(type){
				var num1 = document.getElementById("num1").value;
				var num2 = document.getElementById("num2").value;
				switch (type){
					case "+":
						document.getElementById("result").value = parseInt(num1)+parseInt(num2);
						break;
					case "-":
						document.getElementById("result").value = parseInt(num1)-parseInt(num2);
						break;
					case "*":
						document.getElementById("result").value = parseInt(num1)*parseInt(num2);
						break;
					case "/":
						document.getElementById("result").value = parseInt(num1)/parseInt(num2);
						break;
					default:
						break;
				}
			}
		</script>
		<table>
			<tr>
				<td>
					<img src="../img/UODJC[}VYOB`V{5V~JKNZAG.png">
				</td>
				<th>
					计算器
				</th>
			</tr>
			<tr>
				<th>第一个数字：</th>
				<td>
					<input type="text" id="num1">
				</td>
			</tr>
			<tr>
				<th>第二个数字：</th>
				<td>
					<input type="text" id="num2">
				</td>
			</tr>
			<tr>
				<td>
					<input type="button" value="+" onclick="cal(this.value)">
				</td>
				<td>
					<input type="button" value="-" onclick="cal(this.value)">
					<input type="button" value="*" onclick="cal(this.value)">
					<input type="button" value="/" onclick="cal(this.value)">
				</td>
			</tr>
			<tr>
				<td>结果</td>
				<td>
					<input type="text" id="result">
				</td>
			</tr>
		</table>
	</body>
</html>
